package com.summer.data.jql.concept.exp;


import com.summer.data.Jsql;
import com.summer.data.dialect.Dialect;
import com.summer.data.jql.Context;
import com.summer.data.jql.behavior.FilterAble;
import com.summer.data.jql.concept.Field;

/**
 * @author 345480567@qq.com
 */
public class OpFilterExp implements FilterAble {

    OP op;

    Field left;

    Field right;

    public OpFilterExp(OP op, Field left, Field right) {
        this.op = op;
        this.left = left;
        this.right = right;
    }

    @Override
    public Jsql toFilterJsql(Context ctx, Dialect dialect) {
        return Jsql.format("%s %s %s", left.toFieldSql(ctx, dialect), op, right.toFieldSql(ctx, dialect));
    }
}

